/* Start Header **************************************************************/
/*!
\file Matrix3x3.h
\author David Seah Seng Chong, sengchong.seah, 250004910
\par email: sengchong.seah@digipen.edu
\date 20 July 2011
\brief 

Copyright (C) 2011 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents
without the prior written consent of DigiPen Institute of
Technology is prohibited.
*/
/* End Header ****************************************************************/

#ifndef CS230_MATRIX3X3_H_
#define CS230_MATRIX3X3_H_

#include "Vector2D.h"
#include "Renderer.hpp"

#ifdef _MSC_VER
// Supress warning: nonstandard extension used : nameless struct/union
#pragma warning( disable : 4201 )
#endif


typedef union Matrix3x3
{
	struct 
	{
		float m00, m01, m02;
		float m10, m11, m12;
		float m20, m21, m22;
	};

	float m[9];
	// float m[3][3];

	Matrix3x3() {}
	Matrix3x3(const float *pArr);
	Matrix3x3(float _00, float _01, float _02,
				float _10, float _11, float _12,
				float _20, float _21, float _22);

	// Assignment operators
	Matrix3x3& operator *= (const Matrix3x3 &rhs);

} Matrix3x3, Mtx33;

#ifdef _MSC_VER
// Supress warning: nonstandard extension used : nameless struct/union
#pragma warning( default : 4201 )
#endif

// Binary operators
Matrix3x3 operator * (const Matrix3x3 &lhs, const Matrix3x3 &rhs);
Vector2D  operator * (const Matrix3x3 &lhs, const Vector2D &rhs);
	
void Mtx33Identity(Matrix3x3 &pResult);
void Mtx33Translate(Matrix3x3 &pResult, float x, float y);
void Mtx33Scale(Matrix3x3 &pResult, float x, float y);
void Mtx33RotRad(Matrix3x3 &pResult, float angle);
void Mtx33RotDeg(Matrix3x3 &pResult, float angle);
void Mtx33Transpose(Matrix3x3 &pResult, const Matrix3x3 &pMtx);

D3DXMATRIX Convert3x3(Matrix3x3 transform);
#endif 